#ifndef ALSAAUDIOSINK_H
#define ALSAAUDIOSINK_H

#include <alsa/asoundlib.h>
#include "FrameQueue.h"

class AlsaAudioSink
{
public:
	AlsaAudioSink();
	virtual ~AlsaAudioSink();

	int init(snd_pcm_format_t pcm_format, unsigned int sample_rate, unsigned int channels, int frames = 0);
	int playFrame(uint8_t *data, int size);
	double getBufferDuration();

protected:
	snd_pcm_t *m_Handle;
    snd_pcm_hw_params_t *m_Params;
    snd_pcm_uframes_t m_Frames;

    int m_SampleRate;
};

#endif